package com.gun3y.entity.media;

import com.gun3y.entity.Wrapper;
import com.gun3y.entity.pattern.AttributePattern;
import com.gun3y.entity.pattern.ExpressionType;
import com.gun3y.entity.pattern.FieldPattern;
import com.gun3y.entity.pattern.FieldPatternExpression;
import com.gun3y.entity.pattern.FieldType;
import com.gun3y.entity.pattern.TagPattern;

public enum WrapperDataProps {
    name {
	@Override
	public void set(Object obj, String value) {
	    if (obj != null && obj instanceof Wrapper) {
		Wrapper wrapper = (Wrapper) obj;
		wrapper.setName(value);
	    }
	}
    },

    description {
	@Override
	public void set(Object obj, String value) {
	    if (obj != null && obj instanceof Wrapper) {
		Wrapper wrapper = (Wrapper) obj;
		wrapper.setDescription(value);
	    }

	}
    },

    encoding {
	@Override
	public void set(Object obj, String value) {
	    if (obj != null && obj instanceof Wrapper) {
		Wrapper wrapper = (Wrapper) obj;
		wrapper.setEncoding(value);
	    }

	}
    },

    base {
	@Override
	public void set(Object obj, String value) {
	    if (obj != null && obj instanceof Wrapper) {
		Wrapper wrapper = (Wrapper) obj;
		wrapper.setBase(value);
	    }
	}
    },

    attributeExpression {
	@Override
	public void set(Object obj, String value) {
	    if (obj != null && obj instanceof AttributePattern) {
		AttributePattern attPattern = (AttributePattern) obj;
		attPattern.setAttributeExpression(ExpressionType.valueOf(value));
	    }
	}
    },

    attributeName {
	@Override
	public void set(Object obj, String value) {
	    if (obj != null && obj instanceof AttributePattern) {
		AttributePattern attPattern = (AttributePattern) obj;
		attPattern.setAttributeName(value);
	    }

	}
    },

    attributeValue {
	@Override
	public void set(Object obj, String value) {
	    if (obj != null && obj instanceof AttributePattern) {
		AttributePattern attPattern = (AttributePattern) obj;
		attPattern.setAttributeValue(value);
	    }
	}
    },
    pattern {
	@Override
	public void set(Object obj, String value) {
	    if (obj != null && obj instanceof FieldPatternExpression) {
		FieldPatternExpression fieldPatternExpression = (FieldPatternExpression) obj;
		fieldPatternExpression.setPattern(value);
	    }

	}
    },

    group {
	@Override
	public void set(Object obj, String value) {
	    if (obj != null && obj instanceof FieldPatternExpression) {
		FieldPatternExpression fieldPatternExpression = (FieldPatternExpression) obj;
		fieldPatternExpression.setGroup(value);
	    }

	}
    },

    inclusive {
	@Override
	public void set(Object obj, String value) {
	    if (obj != null && obj instanceof FieldPatternExpression) {
		FieldPatternExpression fieldPatternExpression = (FieldPatternExpression) obj;
		fieldPatternExpression.setInclusive(Boolean.parseBoolean(value));
	    }

	}
    },

    expressionType {
	@Override
	public void set(Object obj, String value) {
	    if (obj != null && obj instanceof FieldPatternExpression) {
		FieldPatternExpression fieldPatternExpression = (FieldPatternExpression) obj;
		fieldPatternExpression.setExpressionType(ExpressionType.valueOf(value));
	    }

	}
    },

    fieldAttribute {
	@Override
	public void set(Object obj, String value) {
	    if (obj != null && obj instanceof FieldPattern) {
		FieldPattern fieldPattern = (FieldPattern) obj;
		fieldPattern.setTagAttribute(value);
	    }
	}
    },

    fieldName {
	@Override
	public void set(Object obj, String value) {
	    if (obj != null && obj instanceof FieldPattern) {
		FieldPattern fieldPattern = (FieldPattern) obj;
		fieldPattern.setFieldName(PropertyType.valueOf(value));
	    }
	}
    },

    fieldType {
	@Override
	public void set(Object obj, String value) {
	    if (obj != null && obj instanceof FieldPattern) {
		FieldPattern fieldPattern = (FieldPattern) obj;
		fieldPattern.setFieldType(FieldType.valueOf(value));
	    }
	}
    },

    multipleResults {
	@Override
	public void set(Object obj, String value) {
	    if (obj != null && obj instanceof FieldPattern) {
		FieldPattern fieldPattern = (FieldPattern) obj;
		fieldPattern.setMultipleResults(Boolean.parseBoolean(value));
	    }
	}
    },

    recursive {
	@Override
	public void set(Object obj, String value) {
	    if (obj != null && obj instanceof TagPattern) {
		TagPattern tagPattern = (TagPattern) obj;
		tagPattern.setRecursive(Boolean.parseBoolean(value));
	    }
	}
    },

    tagExpression {
	@Override
	public void set(Object obj, String value) {
	    if (obj != null && obj instanceof TagPattern) {
		TagPattern tagPattern = (TagPattern) obj;
		tagPattern.setTagExpression(ExpressionType.valueOf(value));
	    }
	}
    },

    tagName {
	@Override
	public void set(Object obj, String value) {
	    if (obj != null && obj instanceof TagPattern) {
		TagPattern tagPattern = (TagPattern) obj;
		tagPattern.setTagName(value);
	    }
	}
    },

    tagValue {
	@Override
	public void set(Object obj, String value) {
	    if (obj != null && obj instanceof TagPattern) {
		TagPattern tagPattern = (TagPattern) obj;
		tagPattern.setTagValue(value);
	    }
	}
    };

    public abstract void set(Object obj, String value);
}
